<?php
//Разобраться со стилями!!!
require_once $_SERVER['DOCUMENT_ROOT'].'/const/Pattern.php';
require_once $_SERVER['DOCUMENT_ROOT'].'/const/Error.php';
?>
<SCRIPT type="text/javascript" src="/view/javascripts/form.js"></SCRIPT>
<?php
$user = unserialize($_SESSION['user']);
?>
<DIV class="block">
	<H1>Редактирование личных данных</H1>
	<FORM action="/person/updatePrivate.html" method="post" id="edit">
		<TABLE>
			<TR>
				<TD>имя пользователя:</TD>
				<TD><?php echo $user->getLogin();?></TD>
			</TR>
			<TR>
				<TD><LABEL for="surname">фамилия:</LABEL></TD>
				<TD><INPUT name="surname" value="<?php echo $user->getSurname();?>"></TD>
			</TR>
			<TR>
				<TD><LABEL for="name">имя:</LABEL></TD>
				<TD><INPUT name="name" value="<?php echo $user->getName();?>"></TD>
			</TR>
			<TR>
				<TD><LABEL for="patronymic">отчество:</LABEL></TD>
				<TD><INPUT name="patronymic" value="<?php echo $user->getPatronymic();?>"></TD>
			</TR>
		</TABLE>
		<P>
			<BUTTON type="submit">
				<IMG src="/view/img/button-save.png">
				<SPAN>сохранить</SPAN>
			</BUTTON>
		</P>
	</FORM>
</DIV>
<DIV class="block">
<?php 
if(!isset($_SESSION['error'])) {
?>
	<H1>Смена пароля пользователя</H1>
<?php 
} else {
?>
	<H2 class="error"><?php echo $_SESSION['error']; unset($_SESSION['error']);?></H2>
<?php 
}
?>
	<FORM action="/person/password/setPrivate.html" method="post" onsubmit="return checkFormEditPass(this)">
		<INPUT type="hidden" name="identity"
				value="<?php echo $user->getIdentity();?>">
		<TABLE >
			<TR>
				<TD>старый пароль:</TD>
				<TD><INPUT type="password" name="passwordold"></TD>
			</TR>
			<TR>
				<TD>новый пароль:</TD>
				<TD><INPUT type="password" name="password"></TD>
			</TR>
			<TR>
				<TD>подтверждение:</TD>
				<TD><INPUT type="password" name="passwordrep"></TD>
			</TR>
		</TABLE>
		<P>
			<BUTTON type="submit">
				<IMG src="/view/img/button-save.png">
				<SPAN>изменить</SPAN>
			</BUTTON>
		</P>
	</FORM>
</DIV>

<?php

?>